/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-06-12
 * Time: 11:01
 */

/**
 * 匿名内部类，new 接口()
 */

class Person1 {
    private int age;
    private String name;
    /*public void demo1(){
       behavior student = new behavior(){

            public void eat() {
                System.out.println("正在吃饭!");
            }
        };
       student.eat();
    }*/

   public void demo2(){
       new behavior(){
           @Override
           public void eat() {
               System.out.println("我也正在吃饭!");
           }
       }.eat();
   }
}

public class Testdemo2 {
    public static void main(String[] args) {
        Person1 person1 = new Person1();
        person1.demo2();
    }
}
